﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HttpServer
{
    public  partial class HttpReqeust
    {
        public string Method { get; set; }
        public string Url { get; set; }
        public string Protocol { get; set; }

        public HttpReqeust(string msg)
        {
            /* GET /jieaido HTTP/1.1

Host: i.1616.net

User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*'/'*;q=0.8

Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3

Accept-Encoding: gzip, deflate

DNT: 1

Cookie: Uvisitor=76eb0a2ac304bf966e4b36b2aa55d4a8; sid=1; uvid=ff5074014fcb7a28312e9175fc58a82f; CNZZDATA1254545502=1852142249-1433174209-%7C1433760502; Uid=216112; Uname=jieaido; Utime=1433764065; ULtime=1433764065; Uexpire=1436356065; Usecure=dkFxN2bxn6CwLQQSyh3Ljkbw887LHWwKWFOpoJBMmFs4wp9BmRw_vg..; J1616_www_jmail=jieaido%24163%247c6a6a307d6a61357c676a6168

Connection: keep-alive
*   /*/

            if (!msg.StartsWith("GET"))
            {
                return;
            }
            
          string[] msg1=   msg.Split(new char[]{
                '\r', '\n'}
                ,StringSplitOptions.RemoveEmptyEntries);
            string[] msg2 = msg1[0].Split(' ');
            Method = msg2[0];
            Url = msg2[1];
            Protocol = msg2[2];


        }

    }
}
